﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Entity
{
    [Table("User")]
    public class User : BaseUserEnity

    {
        public string Tel { get; set; }//联系电话

        public string Logo { get; set; }//是否是基础

        public string UserName { get; set; }//投币器3
        public string Pwd { get; set; }  //温度   
        public UserType UserTypeId { get; set; }  //用户类型// 企业/个人 
        public string Secret { get; set; }  //密钥  

        public UserState UserStateId { get; set; }  //用户状态  
        public string Name { get; set; }  //用户类型// 企业/个人   
        public string IdCard { get; set; }  //身份证// 企业/个人  
        public string ShortName { get; set; }  //用户类型// 企业/个人   
        public string RegisterNo { get; set; }  //注册号  
        public string BusinessLicense { get; set; }  //营业执照号  
        public string NameOnBank { get; set; }  //银行预留姓名
        public string BankCardNo { get; set; }  //银行卡复印件
        public string IdCardCopy { get; set; }  //身份证复印件  
        public string BankCardCopy { get; set; }  //银行卡复印件
        public string IdCardWidthCopy { get; set; }  //身份证手持复印件  
        public string BankTel { get; set; }  //银行预留手机号
        public string LegalPerson { get; set; }  //法人
        public string LegalPersonIdCard { get; set; }  //法人
        public string Province { get; set; }  //省  
        public string City { get; set; }  //城市  
        public string District { get; set; }  //区  
        public string Address { get; set; }  //地址     
        public string Contact { get; set; }  //联系人  
        public string ContactTel { get; set; }  //联系 人电话  
        public string ShippingAddress { get; set; }  //售货地址 
        public string BankCardChannelNo { get; set; }  //联行号  
        public decimal Rate { get; set; }  //费率     
        public string OpenID { get; set; }  //Openid     
        public string ThirdMchId { get; set; }  //第三方商户id     
        public string ThirdRemark { get; set; }  //第三方商户beizhu 
        public string ParentId { get; set; }//父级id  父子商户
        public string Email { get; set; } //邮箱
        public string RefundPwd { get; set; }//退款密码
        public bool IsCustomPay { get; set; }//是否自定义支付
        public bool OrderSuccess { get; set; }  //购物成功通知
        public bool RefundSuccess { get; set; } //购物退款成功通知
        public bool MchFault { get; set; } //机器故障通知
        public bool IconNotEnough { get; set; } //购物成功通知
        public bool MchOffLine { get; set; } //购物成功通知
        public bool UserAdvice { get; set; } //购物成功通知 

        public bool Other { get; set; } //其他通知 
        public bool ShortageReminder { get; set; } //缺货提醒 
        public string AlipayAccount { get; set; } //支付宝账户
        public string AlipayRealName { get; set; } //支付宝姓名
        public string JoinPayUserName { get; set; } //汇聚用户名
        public bool IsBaseUser { get; set; } //汇聚用户名
        public string remark { get; set; } //汇聚用户名
        public string TradeType { get; set; } //汇聚用户名
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 微信名称
        /// </summary>
        public string wx_name { get; set; }
        /// <summary>
        /// 销售经理ID
        /// </summary>
        public string sale_uid { get; set; }
        /// <summary>
        /// 销售经理名字
        /// </summary>
        public string sale_name { get; set; }
        /// <summary>
        /// 客户来源
        /// </summary>
        public user_source? source { get; set; }
        /// <summary>
        /// 领取日期
        /// </summary>
        public DateTime? collection_time { get; set; }
        /// <summary>
        /// 归池时间
        /// </summary>
        public DateTime? return_pool_time { get; set; }
        /// <summary>
        /// 额外参数
        /// </summary>
        public string ext_params { get; set; }
    }
    public enum UserType
    {
        个人用户 = 30002,
        企业用户 = 30001,
        子账户 = 30003,
        自定义用户 = 30004
    }
    public enum UserState
    {


        待审核 = 31001,
        正常 = 31002,
        禁止 = 31003,
    }
    public class RequiredIfIsCompany : ValidationAttribute
    {

        public Type EnumType { get; set; }
        public override bool IsValid(object value)
        {
            if (value == null)
            {
                return false;
            }

            try
            {
                foreach (var item in Enum.GetValues(this.EnumType))
                {
                    if ((int)item == (int)value)
                    {
                        return true;
                    }

                }
            }
            catch (Exception e)
            {
                return false;
            }


            return false;
        }
        public override string FormatErrorMessage(string name)
        {
            return name + "不合法的字段";
        }
    }
    public class search_rk_userlist
    {
        public string Id { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 用户微信名
        /// </summary>
        public string wx_name { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 电话
        /// </summary>
        public string Tel { get; set; }

        public int MchCount { get; set; }
    }
    /// <summary>
    /// 编辑用户信息时添加数据
    /// </summary>
    public class reset_user_info_params
    {
        public string Id { get; set; }

        public string name { get; set; }

        public string wx_name { get; set; }

        public string Tel { get; set; }
    }
    public enum user_source
    {
        淘宝 = 0,
        官网 = 1,
    }

    public class sale_set_user_base_params
    {
        public string Id { get; set; }
        public string Tel { get; set; }

        public string wx_name { get; set; }

        public user_source? source { get; set; }

        public string Name { get; set; }

    }

    /// <summary>
    /// 定义答题次数
    /// </summary>
    public class answer_count
    {
        public int count { get; set; }
    }
}
